<?php

require_once dirname(__FILE__) . '/../lib/UserDosGeneratorConfiguration.class.php';
require_once dirname(__FILE__) . '/../lib/UserDosGeneratorHelper.class.php';

/**
 * UserDos actions.
 *
 * @package    Amman to London
 * @subpackage UserDos
 * @author     Adel Abu-Saif <adeljas@msn.com>
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class UserDosActions extends autoUserDosActions {

    public function executeFilter(sfWebRequest $request) {
        $course_id = $request->getParameter("course_id");
        $this->setPage(1);

        if ($request->hasParameter('_reset')) {
            $this->setFilters($this->configuration->getFilterDefaults());

            $this->redirect('@user_dos');
        }

        $this->filters = $this->configuration->getFilterForm($this->getFilters());


        if ($course_id) {
            $this->setFilters(array("course_id" => $course_id));
            $this->redirect('@user_dos');
        }
        $this->filters->bind($request->getParameter($this->filters->getName()));
        if ($this->filters->isValid()) {
            $this->setFilters($this->filters->getValues());

            $this->redirect('@user_dos');
        }

        $this->pager = $this->getPager();
        $this->sort = $this->getSort();

        $this->setTemplate('index');
    }

}
